From 918463b430de8038bc15be300f8c727bfa982395 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 30 Sep 2006 11:08:41 +0100 Subject: [PATCH] [HVM] Add sub instruction support to HVM MMIO decoder. This is needed for SMP PAE windows XP SP2. Signed-off-by: Xin Li --- xen/arch/x86/hvm/io.c | 3 +++ xen/arch/x86/hvm/platform.c | 6 ++++++ xen/include/asm-x86/hvm/io.h | 1 + 3 files changed, 10 insertions(+) diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index be2ab47695..f91f37f95d 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -596,6 +596,7 @@ static void hvm_mmio_assist(struct cpu_user_regs *regs, ioreq_t *p, break; case INSTR_CMP: + case INSTR_SUB: if (src & REGISTER) { index = operand_index(src); value = get_reg_value(size, index, 0, regs); @@ -607,6 +608,8 @@ static void hvm_mmio_assist(struct cpu_user_regs *regs, ioreq_t *p, index = operand_index(dst); value = get_reg_value(size, index, 0, regs); diff = value - (unsigned long) p->u.data; + if ( mmio_opp->instr == INSTR_SUB ) + set_reg_value(size, index, 0, regs, diff); } /* diff --git a/xen/arch/x86/hvm/platform.c b/xen/arch/x86/hvm/platform.c index 14f77f1aaf..20cb7ba75f 100644 --- a/xen/arch/x86/hvm/platform.c +++ b/xen/arch/x86/hvm/platform.c @@ -394,6 +394,11 @@ static int hvm_decode(int realmode, unsigned char *opcode, struct instruction *i GET_OP_SIZE_FOR_NONEBYTE(instr->op_size); return mem_reg(instr->op_size, opcode, instr, rex); + case 0x2B: /* sub m32/16, r32/16 */ + instr->instr = INSTR_SUB; + GET_OP_SIZE_FOR_NONEBYTE(instr->op_size); + return mem_reg(instr->op_size, opcode, instr, rex); + case 0x30: /* xor r8, m8 */ instr->instr = INSTR_XOR; instr->op_size = BYTE; @@ -1011,6 +1016,7 @@ void handle_mmio(unsigned long va, unsigned long gpa) case INSTR_CMP: /* Pass through */ case INSTR_TEST: + case INSTR_SUB: mmio_opp->flags = mmio_inst.flags; mmio_opp->instr = mmio_inst.instr; mmio_opp->operand[0] = mmio_inst.operand[0]; /* source */ diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index 0c594fdafa..8ec4747967 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -68,6 +68,7 @@ #define INSTR_TEST 12 #define INSTR_BT 13 #define INSTR_XCHG 14 +#define INSTR_SUB 15 struct instruction { __s8 instr; /* instruction type */ -- 2.30.2